home *** CD-ROM | disk | FTP | other *** search
/ Mac Format 1995 June / MacFormat 25.iso / Shareware City / Developers / OutOfPhase1.1 Source / OutOfPhase Folder / AnalyzerSpec.c < prev    next >
Text File  |  1995-01-04  |  3KB  |  81 lines

  1. /* AnalyzerSpec.c */
  2. /*****************************************************************************/
  3. /*                                                                           */
  4. /*    Out Of Phase:  Digital Music Synthesis on General Purpose Computers    */
  5. /*    Copyright (C) 1994  Thomas R. Lawrence                                 */
  6. /*                                                                           */
  7. /*    This program is free software; you can redistribute it and/or modify   */
  8. /*    it under the terms of the GNU General Public License as published by   */
  9. /*    the Free Software Foundation; either version 2 of the License, or      */
  10. /*    (at your option) any later version.                                    */
  11. /*                                                                           */
  12. /*    This program is distributed in the hope that it will be useful,        */
  13. /*    but WITHOUT ANY WARRANTY; without even the implied warranty of         */
  14. /*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
  15. /*    GNU General Public License for more details.                           */
  16. /*                                                                           */
  17. /*    You should have received a copy of the GNU General Public License      */
  18. /*    along with this program; if not, write to the Free Software            */
  19. /*    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.              */
  20. /*                                                                           */
  21. /*    Thomas R. Lawrence can be reached at tomlaw@world.std.com.             */
  22. /*                                                                           */
  23. /*****************************************************************************/
  24.  
  25. #include "MiscInfo.h"
  26. #include "Audit.h"
  27. #include "Debug.h"
  28. #include "Definitions.h"
  29.  
  30. #include "AnalyzerSpec.h"
  31. #include "Memory.h"
  32. #include "DataMunging.h"
  33.  
  34.  
  35. struct AnalyzerSpecRec
  36.     {
  37.         char*                                String;
  38.     };
  39.  
  40.  
  41. /* create a new analyzer spec */
  42. AnalyzerSpecRec*        NewAnalyzerSpec(char* Identifier)
  43.     {
  44.         AnalyzerSpecRec*    Analyzer;
  45.  
  46.         CheckPtrExistence(Identifier);
  47.         Analyzer = (AnalyzerSpecRec*)AllocPtrCanFail(sizeof(AnalyzerSpecRec),
  48.             "AnalyzerSpecRec");
  49.         if (Analyzer == NIL)
  50.             {
  51.              FailurePoint1:
  52.                 return NIL;
  53.             }
  54.         Analyzer->String = CopyPtr(Identifier);
  55.         if (Analyzer->String == NIL)
  56.             {
  57.              FailurePoint2:
  58.                 ReleasePtr((char*)Analyzer);
  59.                 goto FailurePoint1;
  60.             }
  61.         SetTag(Analyzer->String,"AnalyzerSpecRec.String");
  62.         return Analyzer;
  63.     }
  64.  
  65.  
  66. /* dispose analyzer spec */
  67. void                                DisposeAnalyzerSpec(AnalyzerSpecRec* Analyzer)
  68.     {
  69.         CheckPtrExistence(Analyzer);
  70.         ReleasePtr((char*)Analyzer->String);
  71.         ReleasePtr((char*)Analyzer);
  72.     }
  73.  
  74.  
  75. /* get actual heap block analyzer identifier string */
  76. char*                                GetAnalyzerSpecString(AnalyzerSpecRec* Analyzer)
  77.     {
  78.         CheckPtrExistence(Analyzer);
  79.         return Analyzer->String;
  80.     }
  81.